package RozetkaPages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;


/**
 * Created by Yulia on 05.04.14.
 */
public class BasketPage extends BasePage{
    private static final String PAGE_URL = "";

    private By basket = By.cssSelector(".cart-items");
    private By count = By.cssSelector(".input-text");
    private By makeOrder = By.cssSelector("#popup-checkout");
    private By basketLink = By.name("open_cart");

    public BasketPage(WebDriver driver)
    {
        super(driver,PAGE_URL);
    }

    public void open()
    {
        driver.get(pageUrl);
    }


    @Override
    public boolean isOpened()
    {
        return driver.findElement(basket).isDisplayed();
    }

    public void order(String count)
    {
        setCount(count);
        driver.findElement(makeOrder).click();
    }

    public void setCount(String quantity)
    {
        WebElement countField = driver.findElement(count);
        countField.clear();
        countField.sendKeys(quantity);
    }
}
